import java.util.List;

public class Case implements Comando {

	private Expressao expr;
	private List<AcaoSemantica> conteudo;

	public Case(Expressao expr, List<AcaoSemantica> conteudo) {
		this.expr = expr;
		this.conteudo = conteudo;
	}

	@Override
	public String getCode() {
		StringBuffer sb = new StringBuffer();
		for (AcaoSemantica as : conteudo) {
			sb.append(as.getCode());
			sb.append(System.lineSeparator());
		}
		return sb.toString();
	}
	
	public Expressao getExpr() {
		return expr;
	}

	public boolean possuiBreak() {
		for (AcaoSemantica as : conteudo) {
			if (as instanceof Generico && ((Generico) as).getNome().equals("break")) {
				return true;
			}
		}
		return false;
	}

}
